#pragma once
#include "vn/Dns.h"
#include "vn/Dns.h"

void DnsTest() {_test_func_;
	assert(Dns::GetHostName() == "phatdn");

	IPHostEntry a= Dns::GetHostEntry("");						// local entry
	assert(a.HostName == "phatdn");
//	assert(a.AddressList[0] == IPAddress::Parse("10.0.0.5"));

	IPHostEntry d	= Dns::GetHostEntry("localhost");			// localhost -> this localhost
	assert(d.AddressList[0] == IPAddress::Loopback);

	IPHostEntry e	= Dns::GetHostEntry("phatdn");				// intranet -> this host
	IPHostEntry f	= Dns::GetHostEntry(IPAddress(10,0,0,5));	// IPAdddress
	IPHostEntry g	= Dns::GetHostEntry("phat.mooo.com");		// internet

	IPHostEntry h	= Dns::GetHostEntry(IPAddress::Any);		// no exception!
	IPHostEntry i	= Dns::GetHostEntry(IPAddress::Loopback);	// no exception!

	REQUIRE_EXCEPTION( Dns::GetHostEntry(IPAddress::None ); )		//
	REQUIRE_EXCEPTION( Dns::GetHostEntry(IPAddress::Broadcast); )	//
	// temporary remove because it delay the test
	// can we set timeout for GetHostEntry?
	// REQUIRE_EXCEPTION( Dns::GetHostEntry("_notfound_.com"); )		//
}
